package com.jxufe.getData;

import java.io.IOException;
import java.util.ArrayList;

public class WeatherMain {
	public static void main(String[] args) throws IOException, InterruptedException {
		ArrayList<String> codes = Resouce.getCityCodes();
		while (Resouce.getAllSignals().size() < Resouce.size) {
			Resouce.count = 0;
			for (String code : codes) {
				if (Resouce.checkSign(code)) {
					synchronized (Resouce.lock) {
						Resouce.count++;
					}
					continue;
				}
					
				MyRunnable runnable = Resouce.getRunnable(code);
				new Thread(runnable).start();
			}
//			System.out.println("要录入的城市数"+Resouce.size);
//			System.out.println("当前循执行数:"+ Resouce.count);

			Resouce.logger.info("要录入的城市数" + Resouce.size);
			Resouce.logger.info("当前循执行数:" + Resouce.count);
			synchronized (Resouce.lock) {
				Resouce.lock.wait();// 等待所有线程结束
			}
			System.out.println("最终执行次数" + Resouce.count);
		}
	}

}
